<style lang="css" scoped>
	.ivu-modal{
		height:700px;
		overflow: hidden;
	}
</style>
<template>
  <div>
	<Card>
		<p slot="title" style="height: 32px;line-height:32px;">
			人员详细信息
		</p>
		<Form ref="myForm" :model="formItems" :label-width="90">
			<Row>
				<Col span="12" style="padding:0 2%;">
					<FormItem label="姓名：" prop="name">
						<Input v-model="formItems.name" placeholder="请输入姓名" style="width:50%;"></Input>
					</FormItem>
					<div>
						<FormItem label="性别：" prop="sex" style="float:left">
							<Select v-model="formItems.sex" clearable placeholder='请选择性别'>
								<Option :value="1">男</Option>
								<Option :value="2">女</Option>
							</Select>
						</FormItem>
						<FormItem label="年龄：" prop="age" style="float:left;margin-left:7%;">
							<InputNumber :max="10000" :min="0" v-model="formItems.age"></InputNumber>
						</FormItem>
					</div>
					<FormItem label="手机号：" prop="mobile"  style="clear:both">
							<Input v-model="formItems.mobile" placeholder="请输入手机号" style="width: 50%;"></Input>
					</FormItem>
					<FormItem label="身份证号：" prop="idcard">
							<Input v-model="formItems.idcard" placeholder="请输入身份证号" style="width: 50%;"></Input>
					</FormItem>
					<FormItem label="生日：" prop="shengri">
						<DatePicker type="date" placeholder="选择出生日期" :value="formItems.shengri" style="width: 50%"></DatePicker>
					</FormItem>
					<FormItem label="入职时间：" prop="rztime">
						<DatePicker type="date" placeholder="选择入职时间" :value="formItems.rztime" style="width: 50%"></DatePicker>
					</FormItem>
					<div>
						<FormItem label="是否党员：" prop="isdang" style="float:left">
							<Select v-model="formItems.isdang" clearable placeholder='' style="width:100px">
								<Option value="是">是</Option>
								<Option value="否">否</Option>
							</Select>
						</FormItem>
						<FormItem label="是否退伍军人：" prop="istui" style="float:left;margin-left:3%;" :label-width="100">
							<Select v-model="formItems.istui" clearable placeholder='' style="width:100px">
								<Option value="是">是</Option>
								<Option value="否">否</Option>
							</Select>
						</FormItem>
					</div>
					<div style="clear:both">
						<FormItem label="是否结婚：" prop="isdang" style="float:left">
							<Select v-model="formItems.ishun" clearable placeholder='' style="width:100px">
								<Option value="是">是</Option>
								<Option value="否">否</Option>
							</Select>
						</FormItem>
						<FormItem label="职员状态：" prop="status" style="float:left;margin-left:3%;" :label-width="100">
							<Select v-model="formItems.status" clearable placeholder='' style="width:100px">
								<Option value="在职">在职</Option>
								<Option value="离职">离职</Option>
							</Select>
						</FormItem>
					</div>
					<p style="font-size: 14px;font-weight: bold;padding:15px 0;clear:both;margin-left:-25px;clear:both">家庭父亲信息：</p>
					<FormItem label="父亲姓名：" prop="parentName">
							<Input v-model="formItems.parentName" placeholder="请输入姓名" style="width: 50%;"></Input>
					</FormItem>

					<FormItem label="父亲手机号：" prop="mobile"  style="clear:both">
							<Input v-model="formItems.mobile" placeholder="请输入手机号" style="width: 50%;"></Input>
					</FormItem>
					<FormItem label="父亲身份证号：" prop="idcard">
							<Input v-model="formItems.idcard" placeholder="请输入身份证号" style="width: 50%;"></Input>
					</FormItem>
					<FormItem label="父亲生日：" prop="shengri">
						<DatePicker type="date" placeholder="选择出生日期" :value="formItems.shengri" style="width: 50%"></DatePicker>
					</FormItem>
					<div>
						<FormItem label="父亲性别：" prop="parentsex" style="float:left">
							<Select v-model="formItems.parentsex" clearable placeholder='请选择性别' style="width:100px">
								<Option :value="sexArr.man">男</Option>
								<Option :value="sexArr.woman">女</Option>
							</Select>
						</FormItem>
						<FormItem label="父亲年龄：" prop="parentage" style="float:left;margin-left:7%;">
							<InputNumber :max="10000" :min="0" v-model="formItems.parentage"></InputNumber>
						</FormItem>
					</div>
					<div style="clear:both">
						<FormItem label="父亲是否党员：" prop="isdang" style="float:left">
							<Select v-model="formItems.isdang" clearable placeholder='' style="width:100px">
								<Option value="是">是</Option>
								<Option value="否">否</Option>
							</Select>
						</FormItem>
						<FormItem label="父亲是否退伍军人：" prop="istui" style="float:left;margin-left:3%;" :label-width="100">
							<Select v-model="formItems.istui" clearable placeholder='' style="width:100px">
								<Option value="是">是</Option>
								<Option value="否">否</Option>
							</Select>
						</FormItem>
					</div>
					<p style="font-size: 14px;font-weight: bold;padding:15px 0;clear:both;margin-left:-25px;clear:both">家庭母亲信息：</p>
					<div style="clear:both"></div>
					<FormItem label="母亲姓名：" prop="childName">
							<Input v-model="formItems.childName" placeholder="请输入姓名" style="width: 50%;"></Input>
					</FormItem>
					<div style="clear:both"></div>
					<FormItem label="母亲手机号：" prop="mobile"  style="clear:both">
							<Input v-model="formItems.mobile" placeholder="请输入手机号" style="width: 50%;"></Input>
					</FormItem>
					<FormItem label="母亲身份证号：" prop="idcard">
							<Input v-model="formItems.idcard" placeholder="请输入身份证号" style="width: 50%;"></Input>
					</FormItem>
					<FormItem label="母亲生日：" prop="shengri">
						<DatePicker type="date" placeholder="选择出生日期" :value="formItems.shengri" style="width: 50%"></DatePicker>
					</FormItem>
					<div>
						<FormItem label="母亲性别：" prop="childsex" style="float:left">
							<Select v-model="formItems.childsex" clearable placeholder='请选择性别' style="width:100px">
								<Option :value="sexArr.man">男</Option>
								<Option :value="sexArr.woman">女</Option>
							</Select>
						</FormItem>
						<FormItem label="母亲年龄：" prop="childage" style="float:left;margin-left:7%;">
							<InputNumber :max="10000" :min="0" v-model="formItems.childage"></InputNumber>
						</FormItem>
					</div>
					<div style="clear:both">
						<FormItem label="母亲是否党员：" prop="isdang" style="float:left">
							<Select v-model="formItems.isdang" clearable placeholder='' style="width:100px">
								<Option value="是">是</Option>
								<Option value="否">否</Option>
							</Select>
						</FormItem>
						<FormItem label="母亲是否退伍军人：" prop="istui" style="float:left;margin-left:3%;" :label-width="100">
							<Select v-model="formItems.istui" clearable placeholder='' style="width:100px">
								<Option value="是">是</Option>
								<Option value="否">否</Option>
							</Select>
						</FormItem>
					</div>
					<p style="font-size: 14px;font-weight: bold;padding:15px 0;clear:both;margin-left:-25px;clear:both">家庭子女1信息：</p>
					<FormItem label="子女1姓名：" prop="childName" style="clear:both">
							<Input v-model="formItems.childName" placeholder="请输入姓名" style="width: 50%;"></Input>
					</FormItem>
					<div style="clear:both"></div>
					<FormItem label="子女1手机号：" prop="mobile"  style="clear:both">
							<Input v-model="formItems.mobile" placeholder="请输入手机号" style="width: 50%;"></Input>
					</FormItem>
					<FormItem label="子女1身份证号：" prop="idcard">
							<Input v-model="formItems.idcard" placeholder="请输入身份证号" style="width: 50%;"></Input>
					</FormItem>
					<FormItem label="子女1生日：" prop="shengri">
						<DatePicker type="date" placeholder="选择出生日期" :value="formItems.shengri" style="width: 50%"></DatePicker>
					</FormItem>
					<div>
						<FormItem label="子女1性别：" prop="childsex" style="float:left">
							<Select v-model="formItems.childsex" clearable placeholder='请选择性别' style="width:100px">
								<Option :value="sexArr.man">男</Option>
								<Option :value="sexArr.woman">女</Option>
							</Select>
						</FormItem>
						<FormItem label="子女1年龄：" prop="childage" style="float:left;margin-left:7%;">
							<InputNumber :max="10000" :min="0" v-model="formItems.childage"></InputNumber>
						</FormItem>
					</div>
					<div style="clear:both">
						<FormItem label="子女1是否党员：" prop="isdang" style="float:left">
							<Select v-model="formItems.isdang" clearable placeholder='' style="width:100px">
								<Option value="是">是</Option>
								<Option value="否">否</Option>
							</Select>
						</FormItem>
						<FormItem label="子女1是否退伍军人：" prop="istui" style="float:left;margin-left:3%;" :label-width="100">
							<Select v-model="formItems.istui" clearable placeholder='' style="width:100px">
								<Option value="是">是</Option>
								<Option value="否">否</Option>
							</Select>
						</FormItem>
					</div>
					<p style="font-size: 14px;font-weight: bold;padding:15px 0;clear:both;margin-left:-25px;clear:both">家庭子女2信息：</p>
					<FormItem label="子女2姓名：" prop="childName" style="clear:both">
							<Input v-model="formItems.childName" placeholder="请输入姓名" style="width: 50%;"></Input>
					</FormItem>
					<div style="clear:both"></div>
					<FormItem label="子女2手机号：" prop="mobile"  style="clear:both">
							<Input v-model="formItems.mobile" placeholder="请输入手机号" style="width: 50%;"></Input>
					</FormItem>
					<FormItem label="子女2身份证号：" prop="idcard">
							<Input v-model="formItems.idcard" placeholder="请输入身份证号" style="width: 50%;"></Input>
					</FormItem>
					<FormItem label="子女2生日：" prop="shengri">
						<DatePicker type="date" placeholder="选择出生日期" :value="formItems.shengri" style="width: 50%"></DatePicker>
					</FormItem>
					<div>
						<FormItem label="子女2性别：" prop="childsex" style="float:left">
							<Select v-model="formItems.childsex" clearable placeholder='请选择性别' style="width:100px">
								<Option :value="sexArr.man">男</Option>
								<Option :value="sexArr.woman">女</Option>
							</Select>
						</FormItem>
						<FormItem label="子女2年龄：" prop="childage" style="float:left;margin-left:7%;">
							<InputNumber :max="10000" :min="0" v-model="formItems.childage"></InputNumber>
						</FormItem>
					</div>
					<div style="clear:both">
						<FormItem label="子女2是否党员：" prop="isdang" style="float:left">
							<Select v-model="formItems.isdang" clearable placeholder='' style="width:100px">
								<Option value="是">是</Option>
								<Option value="否">否</Option>
							</Select>
						</FormItem>
						<FormItem label="子女2是否退伍军人：" prop="istui" style="float:left;margin-left:3%;" :label-width="100">
							<Select v-model="formItems.istui" clearable placeholder='' style="width:100px">
								<Option value="是">是</Option>
								<Option value="否">否</Option>
							</Select>
						</FormItem>
					</div>
				</Col>
				<Col span="12" style="padding:0 2%;">
					<p style="font-size: 14px;font-weight: bold;padding:15px 0;clear:both;margin-left:-25px;">晋升记录：</p>
					<tables ref="tables" editable v-model="jstable" :columns = columns2 />
					<p style="font-size: 14px;font-weight: bold;padding:15px 0;clear:both;margin-left:-25px;margin-top:80px;">奖罚记录：</p>
					<tables ref="tables" editable v-model="jftable" :columns = columns2 />
				</Col>
			</Row>
		</Form>
			<div style="">
				<Button type="success" style="margin-right:10px;" @click="submit">确定</Button>	<Button type="info" style="margin-right:10%;">返回</Button>
			</div>
    </Card>
  </div>
</template>
<script>
import Tables from '_c/tables'
import { insertVote } from '@/api/data'
export default {
  name: 'tables_page',
  components: {
    Tables
  },
  data () {
    return {
      columns: [
        { title: '名称', key: 'name', sortable: false, align: 'center' },
        { title: '排序', key: 'sort', sortable: false, align: 'center' },
        {
			  title: '操作',
			  key: 'handle',
			  align: 'center',
			  button: [
			    (h, params, vm) => {
              return h('Button', {
                props: {
                  type: 'primary'
                },
                on: {
                  click: () => {
                    console.log(params)
                    this.formItems = this.tableData[params.index]
                    this.modelshow = true
                  }
                }
              }, '编辑')
			    },
			    (h, params, vm) => {
              return h('Button', {
                props: {
                  type: 'error'
                },
                style: {
                  marginLeft: '10px'
                },
                on: {
                  click: () => {
                    this.tableData.splice(params.index, 1)
                  }
                }
              }, '删除')
			    }
			  ]
        }
      ],
      modelshow: false,
      columns2: [
        { title: '日期', key: 'date', sortable: false, align: 'center' },
        { title: '晋升', key: 'type', sortable: false, align: 'center' },
        { title: '职位', key: 'position', sortable: false, align: 'center' }
      ],
      formItems: {
        type: 1,
        templateid: 1,
        title: '',
        adimg: '',
        everyonevote: 0,
        everyonedayvote: 0,
        everyipdayvote: 0,
        applystarttime: '',
        applyendtime: '',
        votestarttime: '',
        voteendtime: '',
        votetitle1: '',
        votecontent1: '',
        votetitle2: '',
        votecontent2: '',
        votetitle3: '',
        votecontent3: '',
        xn_views: 0,
        xn_vote: 0,
        xn_apply: 0,
        status: 1,
        lock_min: 0,
        lock_vote: 0

      },
      jstable: [],
      jftable: [],
      clickType: 'edit',
      sexArr: { man: '男', woman: '女' }
    }
  },
  methods: {
    handleDelete (params) {
      console.log(params)
    },
    exportExcel () {
      this.$refs.tables.exportCsv({
        filename: `table-${(new Date()).valueOf()}.csv`
      })
    },
    doCancel (data) {
      console.log(222333)
    },
    alertAdd () {
      this.formItems = {}
      this.modelshow = true
      this.clickType = 'add'
    },
    onClickOk () {
      console.log(this.formItems)
      if (this.clickType == 'add') {
        this.tableData.push(this.formItems)
      }
      console.log(this.tableData)
    },
    submit () {
		    insertVote(this.formItems).then(res => {
		    	let data = res.data
		    	if (data.code == 1) {
		    		this.$Message.success('新增成功')
		    		setTimeout(() => {
		    			const msg = this.$router.push({ name: '投票活动' })
		    		}, 1500)
		    	} else {
		    		this.$Message.error('未知异常')
		    	}
		    })
    }
  },
  mounted () {
  		const ids = this.$route.query.id
    this.jstable = this.jsData
    this.jftable = this.jfData
    this.formItems = this.testData[ids]
  }
}
</script>

<style>
.ivu-form .ivu-form-item-label{
	text-align:left
}
.ivu-btn-ghost{
	color: #515a6e;
}
</style>
